////////////////////////////////////////////////////////////////////////////////
// Filename: bumpmapshaderclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _BUMPMAPSHADERCLASS_H_
#define _BUMPMAPSHADERCLASS_H_


//////////////
// INCLUDES //
//////////////
#include <d3d10.h>
#include <d3dx10.h>
#include <fstream>
using namespace std;


////////////////////////////////////////////////////////////////////////////////
// Class name: BumpMapShaderClass
////////////////////////////////////////////////////////////////////////////////
class BumpMapShaderClass
{
public:
	BumpMapShaderClass();
	BumpMapShaderClass(const BumpMapShaderClass&);
	~BumpMapShaderClass();

	bool Initialize(ID3D10Device*, HWND);
	void Shutdown();
	void Render(ID3D10Device*, int, D3DXMATRIX, D3DXMATRIX, D3DXMATRIX, D3DXMATRIX lightWVP,
		ID3D10ShaderResourceView**, ID3D10ShaderResourceView* RTT, ID3D10ShaderResourceView* RTD, D3DXVECTOR3, D3DXVECTOR4, D3DXVECTOR2 offset0, D3DXVECTOR2 offset1,
		D3DXVECTOR3 cameraPosition, D3DXVECTOR4 specularColor, float specularPower,
		D3DXVECTOR4 ambientColor, D3DXVECTOR4 ambientMaterial, D3DXVECTOR4 diffuseMaterial, 
		D3DXVECTOR4 specularMaterial, bool bEnableNoise, bool bEnableNormal);

private:
	bool InitializeShader(ID3D10Device*, HWND, WCHAR*);
	void ShutdownShader();
	void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);

	void SetShaderParameters(D3DXMATRIX, D3DXMATRIX, D3DXMATRIX, D3DXMATRIX lightWVP, 
		ID3D10ShaderResourceView**, ID3D10ShaderResourceView* RTT, ID3D10ShaderResourceView* RTD, D3DXVECTOR3, D3DXVECTOR4, D3DXVECTOR2 offset0, D3DXVECTOR2 offset1,
		D3DXVECTOR3 cameraPosition, D3DXVECTOR4 specularColor, float specularPower,
		D3DXVECTOR4 ambientColor, D3DXVECTOR4 ambientMaterial, D3DXVECTOR4 diffuseMaterial,
		D3DXVECTOR4 specularMaterial, bool bEnableNoise, bool bEnableNormal);
	void RenderShader(ID3D10Device*, int);

private:
	ID3D10Effect* m_effect;
	ID3D10EffectTechnique* m_technique;
	ID3D10InputLayout* m_layout;

	ID3D10EffectMatrixVariable* m_worldMatrixPtr;
	ID3D10EffectMatrixVariable* m_viewMatrixPtr;
	ID3D10EffectMatrixVariable* m_projectionMatrixPtr;

	ID3D10EffectMatrixVariable* m_LightWVP;
	
	ID3D10EffectShaderResourceVariable* m_textureArrayPtr;
	ID3D10EffectVectorVariable* lightDirectionPtr;
	ID3D10EffectVectorVariable* diffuseColorPtr;

	ID3D10EffectVectorVariable* m_waveOffset0;
	ID3D10EffectVectorVariable* m_waveOffset1;

	ID3D10EffectVectorVariable* m_cameraPositionPtr;
	ID3D10EffectVectorVariable* m_specularColorPtr;
	ID3D10EffectScalarVariable* m_specularPowerPtr;
	ID3D10EffectVectorVariable* m_ambientColorPtr;

	ID3D10EffectVectorVariable* m_ambientMaterialPtr;
	ID3D10EffectVectorVariable* m_diffuseMaterialPtr;
	ID3D10EffectVectorVariable* m_specularMaterialPtr;

	ID3D10EffectScalarVariable* m_bEnableNoisePtr;
	ID3D10EffectScalarVariable* m_bEnableNormal;
};

#endif